package com.java1412.service.impl;

import com.java1412.dao.UserMapper;
import com.java1412.entity.User;
import com.java1412.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author java1412
 * @version 1.0.0
 * @create 2021-10-14 16:43
 * @qq 1017080724
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public int insertForeach(List<User> userList) {
        return userMapper.insertForeach(userList);
    }

    @Override
    public List<User> list() {
        List<User> users = userMapper.selectAll();
        return users;
    }

    @Override
    public String saveOne(User user) {
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());
        user.setStatus(1);
        userMapper.insert(user);
        return "保存成功";
    }
}
